package org.tekmob.remindpal.model;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Creates application SQLite database
 * 
 * @author Afifa
 *
 */
public class ReminderSQLiteHelper extends SQLiteOpenHelper {

	public ReminderSQLiteHelper(Context context) {
		// Databse: todos_db, Version: 1
		super(context, "reminders_db", null, 1);
	}

	/**
	 * Create simple table
	 */
	@Override
	public void onCreate(SQLiteDatabase db) {
		// Execute create table SQL
		/*db.execSQL("CREATE TABLE reminders (_id INTEGER PRIMARY KEY AUTOINCREMENT," +
				"name TEXT NOT NULL, " +
				"date INT NOT NULL, " +
				"month INT NOT NULL, " +
				"year INT NOT NULL, " +
				"hour INT NOT NULL, " +
				"minute INT NOT NULL, " +
				"sound TEXT NOT NULL, " +
				"vibrate boolean NOT NULL," +
				"increasing boolean NOT NULL, " +
				"move boolean NOT NULL, " +
				"shake boolean NOT NULL );");*/
		db.execSQL("CREATE TABLE reminders (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," +
				"name TEXT NOT NULL, " +
				"date INT NOT NULL, " +
				"month INT NOT NULL, " +
				"year INT NOT NULL, " +
				"hour INT NOT NULL, " +
				"minute INT NOT NULL, " +
				"sound TEXT NOT NULL, " +
				"vibrate TEXT NOT NULL," +
				"increasing TEXT NOT NULL, " +
				"move TEXT NOT NULL, " +
				"shake TEXT NOT NULL);");
	}

	/**
	 * Recreates table
	 */
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVer, int newVer) {
		// DROP table
		db.execSQL("DROP TABLE IF EXISTS reminders");
		// Recreate table
		onCreate(db);
	}
	
}

